#include "StdAfx.h"
#include "Reverb.h"


CReverb::CReverb(void)
{
	m_wrloc = 0;
	int delay =1000;
	m_rdloc = (m_wrloc - delay * 15 + 200000) % 200000;
	m_queue.resize(200000);
	m_wet = 0.5;
	m_dry = 0.5;

	m_lastOne = 0;
	m_lastTwo = 0;
	counter = 0;
}


CReverb::~CReverb(void)
{
}


void CReverb::Process(double *frameIn, double *frameOut, double time)
{
	const int QUEUESIZE = 200000;

    // Loop over the channels
    for(int c=0;  c<2;  c++)
    {
        // Add output of the queue to the current input
		frameOut[c] = m_dry * frameIn[c] + m_wet * m_queue[m_rdloc + c];
		m_queue[m_wrloc + c] = frameOut[c];
    }


    m_wrloc = (m_wrloc + 2) % QUEUESIZE;
    m_rdloc = (m_rdloc + 2) % QUEUESIZE;
}